# include <bits/stdc++.h>
# define MAXN 1000003
using namespace std;

inline int gn() {
    int k = 0, f = 1;
    char c = getchar();
    for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
    for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
    return k * f;
}

int n, ans[MAXN];
vector<pair<int, int> > a, b;

int main() {
    n = gn();
    for(int i = 0; i < n; i++) {
        int k = -gn();
        a.push_back(make_pair(k, i));
    }
    for(int i = 0; i < n; i++) {
        b.push_back(make_pair(gn(), i));
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    for(int i = 0; i < n; i++) {
        ans[b[i].second] = -a[i].first;
    }
    for(int i = 0; i < n; i++) {
        printf("%d ", ans[i]);
    }

}

